//
//  SISSShowTwoInfoView.m
//  SISSAPP
//
//  Created by 优房网 on 2017/9/5.
//  Copyright © 2017年 优房网. All rights reserved.
//

#import "SISSShowTwoInfoView.h"


@interface SISSShowTwoInfoView ()

/// titleLabel
@property (weak, nonatomic) UILabel *titleLabel;

/// bgView
@property (weak, nonatomic) UIView *bgView;
/// 第一行Label
@property (weak, nonatomic) UILabel *firstContentLabel;
@property (weak, nonatomic) UILabel *firstTitleLabel;
/// 第二行Label
@property (weak, nonatomic) UILabel *secondContentLabel;
@property (weak, nonatomic) UILabel *secondTitleLabel;

/// 水印
@property (weak, nonatomic) UIImageView *waterMarkImageView;

@end
@implementation SISSShowTwoInfoView

- (void)setTitle:(NSString *)title {
    _title = title;
    self.titleLabel.text = title;
}

- (void)setFirstTitle:(NSString *)firstTitle {
    _firstTitle = firstTitle;
    self.firstTitleLabel.text = firstTitle;
}

- (void)setSecondTitle:(NSString *)secondTitle {
    _secondTitle = secondTitle;
    self.secondTitleLabel.text = secondTitle;
}

- (void)setFirstContent:(NSString *)firstContent {
    _firstContent = firstContent;
    self.firstContentLabel.text = firstContent;
}

- (void)setSecondContent:(NSString *)secondContent {
    _secondContent = secondContent;
    self.secondContentLabel.text = secondContent;
}

#pragma mark - UI
- (void)initUI {
    [super initUI];
    
    UILabel *titleLabel = [[UILabel alloc] init];
    titleLabel.text = @"一、中介方：";
    titleLabel.textColor = MAIN_TEXT_COLOR;
    titleLabel.font = [UIFont boldSystemFontOfSize:15];
    [self addSubview:titleLabel];
    self.titleLabel = titleLabel;
    
    UIView *bgView = [[UIView alloc] init];
    bgView.backgroundColor = COLOR(0xF1F1F5);
    bgView.layer.cornerRadius = 5;
    bgView.layer.masksToBounds = YES;
    [self addSubview:bgView];
    self.bgView = bgView;
    
    UILabel *firstTitleLabel = [[UILabel alloc] init];
    firstTitleLabel.text = @"公司名称";
    firstTitleLabel.textColor = COLOR(0x8998A5);
    firstTitleLabel.font = [UIFont systemFontOfSize:15];
    [self.bgView addSubview:firstTitleLabel];
    self.firstTitleLabel = firstTitleLabel;
    
    UILabel *firstContentLabel = [[UILabel alloc] init];
    firstContentLabel.text = @" ";
    firstContentLabel.textColor = MAIN_TEXT_COLOR;
    firstContentLabel.numberOfLines = 0;
    firstContentLabel.font = [UIFont boldSystemFontOfSize:15];
    [self.bgView addSubview:firstContentLabel];
    self.firstContentLabel = firstContentLabel;
    
    UILabel *secondTitleLabel = [[UILabel alloc] init];
    secondTitleLabel.text = @"统一社会信用代码：";
    secondTitleLabel.textColor = COLOR(0x8998A5);
    secondTitleLabel.font = [UIFont systemFontOfSize:15];
    [self.bgView addSubview:secondTitleLabel];
    self.secondTitleLabel = secondTitleLabel;
    
    UILabel *secondContentLabel = [[UILabel alloc] init];
    secondContentLabel.text = @" ";
    secondContentLabel.numberOfLines = 0;
    secondContentLabel.textColor = MAIN_TEXT_COLOR;
    secondContentLabel.font = [UIFont boldSystemFontOfSize:15];
    [self.bgView addSubview:secondContentLabel];
    self.secondContentLabel = secondContentLabel;
    
    UIImageView *waterMarkImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"dataWaterMark"]];
    [waterMarkImageView sizeToFit];
    waterMarkImageView.hidden = YES;
    [self.bgView addSubview:waterMarkImageView];
    
    self.waterMarkImageView = waterMarkImageView;
}

#pragma mark - 布局
- (void)initConstraint {
    [super initConstraint];
    
    WeakSelf
    CGFloat margin = 8.0;
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf).offset(2 * margin);
        make.top.equalTo(weakSelf).offset(2 * margin);
    }];
    
    [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.titleLabel);
        make.top.equalTo(weakSelf.titleLabel.mas_bottom).offset(2 * margin);
        make.right.equalTo(weakSelf).offset(-2 * margin);
        make.bottom.equalTo(weakSelf).offset(-margin);
    }];
    
    [self.firstTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.bgView).offset(margin);
        make.top.equalTo(weakSelf.bgView).offset(2 * margin);
    }];
    [self.firstContentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.firstTitleLabel.mas_right);
        make.top.equalTo(weakSelf.firstTitleLabel);
        make.right.lessThanOrEqualTo(weakSelf.bgView);
    }];
    
    [self.secondTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.firstTitleLabel);
        make.top.equalTo(weakSelf.firstContentLabel.mas_bottom).offset(2 * margin);
    }];
    [self.secondContentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.secondTitleLabel.mas_right);
        make.top.equalTo(weakSelf.secondTitleLabel);
        make.right.lessThanOrEqualTo(weakSelf.bgView);
        make.bottom.equalTo(weakSelf.bgView).offset(-2 * margin);
    }];
    
    [self.waterMarkImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(weakSelf.bgView);
    }];
}

@end
